The Sound Manager allows you both to stop a sound currently in progress in a channel and to remove all pending sound commands from a channel.
If you have started a sound playing by using the SndStartFilePlay function, then you can stop play by using the SndStopFilePlay function. See "Managing an Asynchronous Play From Disk" for more details.
To cause the Sound Manager to stop playing the sound in progress, send the quietCmd command. Here's an example:
mySndCmd.cmd := quietCmd; {the command is quietCmd}
mySndCmd.param1 := 0; {unused}
mySndCmd.param2 := 0; {unused}
{stop the sound now playing}
myErr := SndDoImmediate(mySndChan, mySndCmd, FALSE);
To bypass the command queue, you should issue quietCmd by using SndDoImmediate . Any sound commands that are already in the sound channel remain there, however, and further sound commands can be queued in that channel.
If you wish to flush a sound channel without disturbing any sounds already in progress, issue the flushCmd command. Here's an example:
mySndCmd.cmd := flushCmd; {the command is flushCmd}
mySndCmd.param1 := 0; {unused}
mySndCmd.param2 := 0; {unused}
{flush the channel}
myErr := SndDoImmediate(mySndChan, mySndCmd, FALSE);
If you want to stop all sound production by a particular sound channel immediately, you should issue a flushCmd command and then a quietCmd command. If you issue only a flushCmd command, the sound currently playing is not stopped. If you issue only a quietCmd command, the Sound Manager stops the current sound but continues with any other queued commands. (By calling flushCmd before quietCmd , you ensure that no other queued commands are processed.)
The Sound Manager sends a quietCmd command when your application calls the SndDisposeChannel function. The quietCmd command is preceded by a flushCmd command if the quietNow parameter is TRUE .
| Previous | Chapter contents | Chapter top | Section top | Next |